Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce to weak model #1387

Merged
merged 10 commits into from
Dec 11, 2024
Merged

Introduce to weak model #1387

merged 10 commits into from
Dec 11, 2024

Conversation

KennyDizi
Copy link
Contributor

@KennyDizi KennyDizi commented Dec 8, 2024

PR Type

Enhancement, Documentation


Description

  • Introduced a new WEAK model type, replacing the previous TURBO model.
  • Updated various functions to utilize the WEAK model as the default for specific flows.
  • Revised documentation to guide users on configuring the new WEAK model.
  • Adjusted configuration files to reflect the new model settings.

Changes walkthrough 📝

Relevant files
Enhancement
10 files
pr_processing.py
Update model handling to use weak model by default             

pr_agent/algo/pr_processing.py

  • Changed default model type from REGULAR to WEAK in
    retry_with_fallback_models.
  • Updated _get_all_models to handle WEAK model type.
  • +4/-4     
    utils.py
    Modify ModelType Enum to include weak model                           

    pr_agent/algo/utils.py

    • Removed TURBO model type.
    • Added WEAK model type.
    +1/-2     
    utils.py
    Update model configuration for weak model                               

    pr_agent/git_providers/utils.py

  • Updated configuration to set model_weak instead of model_turbo.
  • +1/-1     
    pr_code_suggestions.py
    Use weak model for code suggestions                                           

    pr_agent/tools/pr_code_suggestions.py

  • Changed model type used in retry_with_fallback_models from REGULAR to
    WEAK.
  • +2/-2     
    pr_description.py
    Switch to weak model for PR description generation             

    pr_agent/tools/pr_description.py

    • Updated model type in retry_with_fallback_models to WEAK.
    +1/-1     
    pr_help_message.py
    Adjust help message generation to use weak model                 

    pr_agent/tools/pr_help_message.py

    • Changed model type in retry_with_fallback_models to WEAK.
    +1/-1     
    pr_line_questions.py
    Modify line question handling to use weak model                   

    pr_agent/tools/pr_line_questions.py

    • Updated model type in retry_with_fallback_models to WEAK.
    +1/-1     
    pr_questions.py
    Use weak model for question handling                                         

    pr_agent/tools/pr_questions.py

    • Changed model type in retry_with_fallback_models to WEAK.
    +1/-1     
    pr_reviewer.py
    Ensure reviewer uses regular model                                             

    pr_agent/tools/pr_reviewer.py

    • Updated model type in retry_with_fallback_models to REGULAR.
    +1/-1     
    pr_update_changelog.py
    Update changelog generation to use weak model                       

    pr_agent/tools/pr_update_changelog.py

    • Changed model type in retry_with_fallback_models to WEAK.
    +1/-1     
    Documentation
    1 files
    changing_a_model.md
    Revise usage guide for weak model configuration                   

    docs/docs/usage-guide/changing_a_model.md

  • Updated documentation to reflect changes from model_turbo to
    model_weak.
  • +11/-11 
    Configuration changes
    1 files
    configuration.toml
    Update configuration for weak model settings                         

    pr_agent/settings/configuration.toml

  • Set model_weak to a specific model version.
  • Adjusted default model configuration.
  • +2/-2     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🏅 Score: 85
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Variable Name Typo
    The variable name 'model_week' appears to be a typo and should likely be 'model_weak' to match the WEAK model type

    Configuration Mismatch
    The model configuration appears inconsistent - using 'model_week' in code but config shows 'gpt-4o-mini' which may not align with intended WEAK/REGULAR model types

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Dec 8, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    ✅ Add graceful fallback when configuration settings are missing
    Suggestion Impact:The commit added a check for the 'model_weak' configuration setting, providing a fallback to the default model if it is missing, which aligns with the suggestion's intention.

    code diff:

    +def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]:
    +    if get_settings().config.get('model_weak') and model_type == ModelType.WEAK:
    +        model = get_settings().config.model_weak

    Add error handling for the case when the model configuration is missing. Currently,
    if the config doesn't have the required model setting, it will raise an unhandled
    attribute error.

    pr_agent/algo/pr_processing.py [357-360]

     if model_type == ModelType.WEAK:
    -    model = get_settings().config.model_week
    +    model = getattr(get_settings().config, 'model_week', get_settings().config.model)
     else:
         model = get_settings().config.model
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion adds important error handling to prevent crashes when configuration settings are missing, providing a graceful fallback to the default model.

    7
    • Author self-review: I have reviewed the PR code suggestions, and addressed the relevant ones.

    💡 Need additional feedback ? start a PR chat

    @KennyDizi
    Copy link
    Contributor Author

    PR Description updated to latest commit (e3d779c)

    @KennyDizi
    Copy link
    Contributor Author

    @mrT23 I've updated the PR according to your comments, pls take a look at it again.

    @mrT23 mrT23 merged commit cb88489 into qodo-ai:main Dec 11, 2024
    2 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants